#ifndef BUILDER_H
#define BUILDER_H

#include "liza.h"

static int const_counter = 0;

Function *buildMainFunction(Module *mod);

Value *buildLocalIntInit(BasicBlock *mod, string name, int value);

Value *buildGlobalIntInit(Module *mod, string name, int value);

Value *buildGlobalStrInit(Module *mod, string name, string value);

void makeStandardDefines(Module *mod);

Value *createStringConstant(Module *mod, string value);

Value *createStringValue(Value *value, BasicBlock *block);

Value *callDef(Function *func, vector<Value*> params, BasicBlock *block);

Value *createStringConcat(Value *val1, Value* val2, BasicBlock *block, Module *mod);

Value *storeInteger(int value, Module *mod);

Value *buildAddOperation(Value *v1, Value *v2, BasicBlock *block);

Value *buildSubOperation(Value *v1, Value *v2, BasicBlock *block);

Value *buildMulOperation(Value *v1, Value *v2, BasicBlock *block);

Value *buildDivOperation(Value *v1, Value *v2, BasicBlock *block);

LoopNode *buildForHeadBlock(BasicBlock *block, Value *times);

void buildIncrInstr(LoopNode *node, BasicBlock *block);

BasicBlock *getNextBlock(BasicBlock *cur);

Value* initStringLocalVar(string name, BasicBlock *block, Value *expression, Module *mod);
#endif
